<template>
	<view class="main">
		<view class="rm-nav dis-row">
			<scroll-view scroll-x="true" class="swpview">
				<view v-for="(navitem,navindex) in navTileList" :key="navindex" class="poser" 
				@click="changeNav(navitem,navindex)" :class="{'navcheck':current == navindex}"
				>
					{{navitem.name}}
					<view class="navps" v-if="current == navindex"><label></label></view>
				</view>
			</scroll-view>
		</view>
		<!--列表部分-->
		<block v-if="rowArr.length>0">
		<!--list start-->
		<view class="rm-list v-box dis-clm" v-for="(item,index) in rowArr" :key="index">
			<view class="rmlist-name dis-row poser" @click="navInfonext(item)">
				<label v-if="item.status == 0">正在找</label>
				<label v-if="item.status && item.status == 1" class="shenhe">审核中</label>
				<label v-if="item.status && item.status == 2" class="weitong">未通过</label>
				<label v-if="item.status && item.status == 9" class="zhanman">已招满</label>
				<text style="text-indent: 100rpx;line-height: 52rpx;">{{item.title}}</text>
			</view>
			<view class="button-v1 dis-row">
				<view class="map-ico"><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/my/ico-address.svg"></image></view>
				<view class="bt-s dis-row">
					<label>{{item.cityArea}}</label><text>·</text><label>{{item.createTime}}</label>
				</view>
			</view>
			<view class="rm-blockin" v-if="item.isFinished&&item.isFinished.length>0">
				<block v-for="(v) in item.isFinished">
					<label v-if="v.isFinished == 1">{{v.skillName}}已招满</label>
				</block>
			</view>
			<!-- <view class="rm-blockin" v-if="item.isFinished.length ==0">
					<label>未招满</label>
			</view> -->
			<view class="rm-btnList poser" v-if="item.status == 0">
				<view class="pvs-gv dis-row">
					 <label @click="editInfo(item)">修改</label>
					<label v-if="item.finished == 0" @click="openZhaoman(item)">已招满</label>
					<label @click="shuaxin(item)">刷新</label>
					<label class="blueActive" @click="topDing(item)">我要置顶</label>
				</view>
			</view>
			<block v-if="item.status == 1">
				<view class="rm-btnList poser">
					<view class="pvs-gv dis-row">
						<label class="huiActive">等待审核完成</label>
					</view>
				</view>
			</block>
			
			<block v-if="item.status == 2">
				<view class="node-text v-box">
					审核失败：{{item.failure?item.failure:'暂无反馈信息'}}
				</view>
				<view class="rm-btnList poser" >
					<view class="pvs-gv dis-row" @click="editInfo(item)">
						<label class="blueActive">修改</label>
					</view>
				</view>
			</block>
			<block v-if="item.status == 9">
				<view class="rm-blockin">
					<label>全部招满</label>
				</view>
				<view class="rm-btnList poser">
					<view class="pvs-gv dis-row" @click="goonline(item)">
						<label class="blueActive">重新上线</label>
					</view>
				</view>
			</block>
		</view>
		<!--list over-->
		</block>
		<block v-if="rowArr.length==0">
			<view class="empty-img">
				<image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/icon50.png"></image>
				<label>暂无内容</label>
			</view>
		</block>
		<!--list start-->
		<!-- <view class="rm-list v-box dis-clm">
			<view class="rmlist-name dis-row">
				<label class="shenhe">审核中</label>
				<text>陕西未央区招钢筋工、混凝土、木工</text>
			</view>
			<view class="button-v1 dis-row">
				<view class="map-ico"><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/my/ico-address.svg"></image></view>
				<view class="bt-s dis-row">
					<label>陕西西安</label><text>·</text><label>01-20 19:00:00</label>
				</view>
			</view>
			<view class="rm-btnList poser">
				<view class="pvs-gv dis-row">
					<label class="huiActive">等待审核完成</label>
				</view>
			</view>
		</view> -->
		<!--list over-->
		<view style="height: 20rpx;"></view>
		
		<u-popup
			:show="fraction" 
			:round="10" 
			customStyle="width:90%;" 
			mode="center" 
			:closeable="true" 
			@close="closeFraction"
			@open="openFraction"
			>
			<view class="fraction">
				<image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/icon/go_online.svg"></image>
				<view>确认要重新上线？</view>
				<u-button type="primary" customStyle="background:#0575FF; font-size:32rpx; margin-bottom: 24rpx;" text="重新上线" @click="onlineClick"></u-button>
				<u-button type="info" customStyle="font-size:32rpx;" @click="closeFraction" text="取消"></u-button>
			</view>
		</u-popup>
		<u-popup
			:show="zhaoman" 
			:round="10" 
			customStyle="width:100%;" 
			mode="bottom" 
			:closeable="true" 
			@close="closeZhaoman"
			@open="openZhaomans"
			>
			<view class="zhaoman">
				<scroll-view style="max-height: 800rpx;" scroll-y>
				<view class="person-lst dis-clm v-box">
				   <view v-for="(item,index) in orderInfo.itemList" 
						@click="singleOrder(item)" class="person-item row-box">{{item.skillName}}<view>招满</view></view>
				</view>
				</scroll-view>
				<u-button type="primary" customStyle="background:#0575FF; font-size:32rpx; margin-bottom: 24rpx;" text="全部招满" @click="zhaomanctrole"></u-button>
				<u-button type="info" customStyle="font-size:32rpx;" @click="closeZhaoman" text="取消"></u-button>
			</view>
		</u-popup>
	</view>
</template>

<script>
import Index from "@/common/index-model.js"
let index = new Index()
let that = null	
export default {
	data() {
		return {
			fraction:false,
			navTileList:[
				{name:'全部',status:12},
				{name:'正在招',status:0},
				{name:'审核中',status:1},
				{name:'未通过',status:2}, //9 已经下线
				{name:'已招满',status:9}
			],
			current:0,
			rowArr:[],
			onlineOrderId:'',
			zhaoman: false,
			orderInfo: [],
		}
	},
	onLoad() {
	   this.getListRow({})	
	},
	onPullDownRefresh() {
		setTimeout(function () {
			uni.stopPullDownRefresh();
		}, 1000);
	},
	methods: {
		onlineClick() {},
		closeZhaoman(){
			this.zhaoman=false;
		},
		openZhaoman(item){
			this.getOrderInfo(item.orderId);
			this.zhaoman=true;
		},
		openZhaomans() {
			this.zhaoman=true;
		},
		singleOrder(item){
			let url="/client/job/set/full";
			let param={
				id:item.id,
				isFinished:1,
				status:1,
				orderId:this.orderInfo.orderId
			}
			index.getPublicUserMember(param,url,'post',res=>{
				if(res.data.code == 200 && res.data.success){
					index.show_tips('操作成功');
					this.closeZhaoman();
					setTimeout(()=>{
						 this.getListRow({})	
					},500)
				}else{
					index.show_tips(res.data.message)
					return false
				}
			})
		},
		getOrderInfo(orderId){
			let url="client/job/find/details/"+orderId
			index.getPublicUserMember({},url,'get',res=>{
				console.log(res.data);
				if(res.data.code == 200 && res.data.success){
					this.orderInfo=res.data.result;
				}
			})
		},
		zhaomanctrole() {
			let url = "client/job/modify/"+this.orderInfo.orderId
			index.getPublicUserMember({},url,'post',res=>{
				if(res.data.code == 200 && res.data.success){
					index.show_tips('修改好活招满成功')
					this.zhaoman=false;
					setTimeout(()=>{
						 this.getListRow({})	
					},500)
				}else{
					index.show_tips(res.data.message)
					return false
				}
			})
		},
		//跳转到详情页
		navInfonext(item) {
			let url = '../../pagesB/jobinfo/index?id=' + item.orderId
			index.navigate_to(url)
		},
		topDing(item) {
			let url='/pagesC/jobTop/index?id='+ item.orderId
			index.navigate_to(url)
		},
		//重新上线
		goonline(item) {
			let url="client/job/come/back/online/"+item.orderId
			index.getPublicUserMember({},url,'post',res=>{
				console.log(res,'====rrrrr====')
				if(res.data.code == 200 && res.data.success){
					index.show_tips('你的请求已经提交')
					setTimeout(()=>{
						  this.getListRow({})	
					},300)
				}else{
					index.show_tips(res.data.message)
					return false
				}
			})
		},
		shuaxin(item) {
			console.log(item,'3333')
			 let url="client/job/recruitment/refresh/"+item.orderId
			 index.getPublicUserMember({},url,'post',res=>{
				 uni.showLoading({
				 	title:'加载中...'
				 })
				 if(res.data.code == 200 && res.data.success){
					 uni.hideLoading()
					 index.show_tips('刷新成功')
					 this.getListRow({})
				 }else{
					  uni.hideLoading()
					  index.show_tips(res.data.message)
					  return false
				 }
			 })
		},
		//修改招工信息
		editInfo(item) {
			console.log(item,'===55===')
			// let url="../../pagesB/perfectWork/edit?id="+item.orderId
			let url="../../pagesB/jobinfo/newedit?id="+item.orderId
			index.navigate_to(url)
		},
		closeFraction() {
			this.fraction =false
		},
		openFraction() {
			this.fraction =true
		},
		changeNav(item,index) {
			this.current = index
			if(item.status == 12){
				this.getListRow({})
			}else{
				this.getListRow({status:item.status})
			}
		},
		getListRow(send) {
			this.rowArr = []
			index.getPublicUserMember(send,'client/job/recruitment/management','get',res=>{
				console.log(res,'===5555====')
				if(res.data.code == 200 && res.data.success){
					this.rowArr = res.data.result
				}else{
					this.rowArr=[]
				}
			})
		}
	}
}
</script>

<style>
@import url("@/static/css/publics.css");
@import url("@/static/css/RecruitmentManagement.css");	
.zhaoman{ padding: 60rpx 20rpx 20rpx 20rpx;}
.person-item{height: 88rpx;line-height: 88rpx; border-bottom: 2rpx solid #F3F3F3; 
margin-bottom: 40rpx;font-size: 28rpx;color: #424242;
border-radius: 6rpx;
}
/* .person-item:last-child{border: none;} */
.personActice{background-color: #E4F0FF;color: #0575FF;border: 1rpx solid #0575FF;}
.person-item view{ float: right;height: 68rpx;line-height: 68rpx; margin: 10rpx 0rpx;
 background: #0575FF; color: #fff; border-radius: 68rpx; font-size: 24rpx; padding:  0 40rpx; }
</style>